﻿@model IEnumerable<QuanLyGiaoVuUI.Models.GiangVienClient.DangKyKetThucLopMonHocViewModel>
@{
    Layout = null;
}

<div>
    <div><h1>THÔNG TIN ĐÃ ĐĂNG KÝ</h1></div>
    <table class="gridtable" cellspacing="0" border="1" bordercolor="#000000" width="100%">
        <tr>
            <th>STT</th>
            <th>Mã Lớp</th>
            <th>Tên Lớp</th>
            <th>Ngày Kết Thúc</th>
            <th>Hủy</th>
        </tr>
        @if (Model != null)
        {
            int count=0;
            foreach(var dangky in Model)
            {
                count++;      
                <tr>
                    <td>@count</td>
                    <td>@dangky.MaLopMonHoc</td>                    
                    <td>@dangky.MonHoc.TenMonHoc</td>
                    <td>@dangky.NgayDangKy</td>
                    <td><a href="#" id="huydangky" rel="@dangky.ID">[X]</a></td>
                </tr>
            }
        }
    </table>
</div>
<script>
    $(document).ready(function () {
        $('#huydangky').click(function () {
            var madangky = $(this).attr("rel");
            $.post("/GiangVienClient/HuyDangKyKetThucLopMonHoc", { id: madangky }, function (data) {
                alert(data.message);
                if (data.success == true) {
                    window.location = "/GiangVienClient/DangKyKetThucLopMonHoc";
                }
            });
        });
    });
</script>